<!DOCTYPE html>
<!-- saved from url=(0076)http://www.uphsh.com/wap/ef73d9dc381d412f964b99e521c270a6/invoice?userToken= -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<base href="http://www.uphsh.com:80/">-->


<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no" name="format-detection">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>极速开票</title>
<link type="text/css" href="../../resource/xhzc/wapcommon.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="../../resource/ystfiles/fapiao.css">
<script src="../../resource/ystfiles/jquery180min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../resource/ystfiles/wapcommon.js"></script>
<script src="../../resource/qrcode.js"></script>


<link rel="stylesheet" href="../../resource/ystfiles/weuimin.css">
<link rel="stylesheet" href="../../resource/ystfiles/example.css">
<script type="text/javascript" src="../../resource/ystfiles/api.js"></script>
<script type="text/javascript" src="../../resource/ystfiles/jweixin1002.js"></script>
<script type="text/javascript" src="../../resource/ystfiles/jweixin1.js"></script>
<script src="../../resource/jquery1.js"></script>
<script src="../../resource/qrcode.js"></script>
<script src="../../resource/jquerybarcode.js"></script>
<script src="../../script/api.js"></script>
<script src="../../resource/ystfiles/qrcode.js"></script>
<script src="../../resource/ystfiles/jquerybarcode.js"></script>
<script type="text/javascript" src="../../script/constants.js"></script>
<script type="text/javascript" src="../../script/aes.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../script/naes.js"></script>
<script type="text/javascript" src="../../script/modeecb.js"></script>
<script type="text/javascript" src="../../script/tmd5.js"></script>
<script type="text/javascript" src="../../resource/xhzc/my.js"></script>
<style>
</style>
</head>

<body>
   <header id="statusBar">
	<div class="header">
				<div class="return">
			<a style="color:#fff" onclick="api.closeWin();" tapmode="presshover">
							<span>返回</span>
					</a>
				</div>
				<div class="tittle">
				单位信息搜索
				</div>
		</div>
		</header>
    <div id="contant" style="height: 563px;">

		<div style="width: 90%" class="FP_btn" onclick="xhzc()" tapmode="presshover">
			<a style="display: inline-block;display: -moz-inline-stack;width: 100%;color: #888;" ><strong style="font-size: 20px;">+</strong>&nbsp;扫描营业执照二维码获取公司（单位）信息</a>
		</div>
    <div class="formContent" style="width: 97%" >
      <dl>
        <dd><input type="text"
			  style="font-size:18px;" name="taxcode" id="taxcode" placeholder="输入税号搜索公司（单位）信息" value="">
           <input type="button" id="search" style="width: 20%;text-align:left;background-color: gray;" value="搜  索" onclick="search();" tapmode="presshover"></dd>
      </dl>
		</div>

		<div style="margin-left:6%;margin-right:6%;margin-top:15%;color:red;">
		*若上面两种方式无法获取您的单位信息,那您可以选择下面的方式录入您的单位信息。
		</div>
		<!--<div style="width: 90%;margin-top:4%;" class="FP_btn"  onclick="searchLit()">
			<a style="display: inline-block;display: -moz-inline-stack;width: 100%;color: #888;" ><strong style="font-size: 20px;">+</strong>&nbsp;扫描营业执照二维码获取单位名称和税号</a>
		</div>-->
		<div style="padding: 0 10px;margin-top:5%;"  onclick="manua();" tapmode="presshover">
		<input type="button" id="btn_sub"  class="button" value="手动录入您的单位信息">
		</div>

		<div style="text-align: center;bottom: 5px;font-size: 12px;margin-top: 30px"  >四川航天信息有限公司<br>客户热线：<a href="tel:95113" style="color: gray;">95113</a></div>
	</div>

<script type="text/javascript">
var taxcode="";//税号
var name="";//单位名称
var defid = $api.getStorage("defid");
var qr = $api.getStorage("qr");
		apiready = function(){
			api.parseTapmode();
			if(api.systemType == "ios"){
			   document.getElementById("statusBar").style.background = "#298cb4";
			}
			$api.fixStatusBar( $api.dom('header') );
      openid = $api.getStorage('openid');
			var header = $api.byId('jsheader');
			if(api.systemType=='ios'){
				$api.fixIos7Bar(header);
			}
		}

  //新户注册
	function xhzc(){
		var FNScanner = api.require('FNScanner');
		FNScanner.openScanner({
		    autorotation: true
		}, function(ret, err){
		   setTimeout(function(){
		   console.log(JSON.stringify(ret));
			if (ret) {
				var content = JSON.stringify(ret.content);
				if (typeof(content) == 'string') {

					if(content.indexOf("：")!=-1){
							try{
								taxcode = content.split('：')[1].split('\\')[0].toString().trim();//公司税号
								name = content.split('：')[3].split('\\')[0].toString().trim();//公司名称

								if((taxcode == "" || taxcode == null || taxcode == "undefined" || typeof(taxcode) == "undefined")||(name == "" || name == null || name == "undefined" || typeof(name) == "undefined")){
									api.alert({
										msg: "信息获取失败!"
									});
								}else{
									//扫描二维码获取
									tegThrodV(taxcode,name);
								}
							}catch(err){
								api.alert({
									msg: err.toLocaleString()
								});
							}
					}else{
						api.alert({
							msg: "信息获取失败,请您正确扫描营业执照二维码!"
						});
					}

			}
		}else{
			alert(JSON.stringify(err));
		}
		},500); 
		});
	}


  function toindex(){
      api.closeWin();
	}

  function search(){
		taxcode=$("#taxcode").val().trim();
		if(!boolValue(taxcode)){
			api.alert({
				msg: "请输入您的单位税号!"
			});
		}else{
				//输入税号搜索获取
			  tegThrodV(taxcode,"");
		}
  }


	function tegThrodV(taxcode,name){
	//alert(taxcode+","+name);
		if(boolTaxcode(taxcode)){
					loadHt();//加载界面
					//调用接口获取客户信息
					//var deviceName = api.deviceName;
					//var deviceId = api.deviceId;

				var callback = function(ret, err){
							rmHt();//去除
							if (ret) {
								if(ret.success){
									//设置标志区分是扫码或搜索录入还是手工录入
									$api.setStorage("lrway","1");//扫码和搜索

										api.openWin({
	 										name: '新户注册',
	 										url: 'userInfo.html',
	 										pageParam: {
	 												taxcode : taxcode,
	 												name : name,
	 												userInfoMap: ret.userInfoMap
	 										},
											progress: {
												type: "default", //加载进度效果类型，默认值为 default，取值范围为 default|page，default 等同于 showProgress 参数效果；为 page 时，进度效果为仿浏览器类型，固定在页面的顶部
												title: "", //type 为 default 时显示的加载框标题
												text: "", //type 为 default 时显示的加载框内容
												color: "" //type 为 page 时进度条的颜色，默认值为 #45C01A，支持#FFF，#FFFFFF，rgb(255,255,255)，rgba(255,255,255,1.0)等格式
											}
	 								});
							}else{
								api.alert({
								 msg: ret.msg
								});
							}
						 }else{
							 api.alert({
								msg: "查询失败,请联系管理员"
							 });
						 }
				}
				var parameter = {"taxcode":taxcode,"name": name};
				apiAjax(JSON.stringify(parameter),url.shcus,callback);
		}else{
			api.alert({
				msg: "三方查询的税号格式有误!"
			});
		}
	}

	//手动录入单位信息
	function manua(){
		$api.setStorage("lrway","2");//手动录入单位信息
		api.openWin({
			name: '新户注册',
			url: 'userInfo.html'//+"?name="+name//taxcode="+taxcode+"
			,
			pageParam: {
					lit: {"taxcode":taxcode,"name": name}
			}
	});
	}

	//扫二维码获取基础信息
	function searchLit(){
		var FNScanner = api.require('FNScanner');
		FNScanner.openScanner({
				autorotation: true
		}, function(ret, err){
			if (ret) {
				var content = JSON.stringify(ret.content);
				if (typeof(content) == 'string') {
				//alert(content);
					if(content.indexOf("：")!=-1){
							try{
								var taxcode = content.split('：')[1].split('\\')[0].toString().trim();//公司税号
								var name = content.split('：')[3].split('\\')[0].toString().trim();//公司名称

								if(!boolValue(taxcode)||!boolValue(name)){
									api.alert({
										msg: "信息获取失败!"
									});
								}else{
									api.openWin({
										name: '新户注册',
										url: 'userInfo.html',
										pageParam: {
												lit: {"taxcode":taxcode,"name": name}
										},
										progress: {
											type: "default", //加载进度效果类型，默认值为 default，取值范围为 default|page，default 等同于 showProgress 参数效果；为 page 时，进度效果为仿浏览器类型，固定在页面的顶部
											title: "", //type 为 default 时显示的加载框标题
											text: "", //type 为 default 时显示的加载框内容
											color: "" //type 为 page 时进度条的颜色，默认值为 #45C01A，支持#FFF，#FFFFFF，rgb(255,255,255)，rgba(255,255,255,1.0)等格式
										}
								});
								}
							}catch(err){
								api.alert({
									msg: err.toLocaleString()
								});
							}
					}else{
						api.alert({
							msg: "信息获取失败,请您正确扫描营业执照二维码!"
						});
					}

			}
		}else{
			alert(JSON.stringify(err));
		}
		});
	}
</script>
</body></html>
